﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;
using Road3App.Model.CrossroadNs.TrafficlightNs;

namespace Road3App.Services.Converters
{
    class TrafficLightStateToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TrafficLightStates state = (TrafficLightStates)value;
            Color color;
            switch (state)
            {
                case TrafficLightStates.Red:
                    color = Colors.Red;
                    break;
                case TrafficLightStates.RedYellow:
                    color = Colors.Orange;
                    break;
                case TrafficLightStates.Yellow:
                    color = Colors.Yellow;
                    break;
                case TrafficLightStates.Green:
                    color = Colors.Green;
                    break;
                case TrafficLightStates.YellowBlinking:
                    color = Colors.OrangeRed;
                    break;
                default:
                    color = Colors.Transparent;
                    break;
            }

            return new SolidColorBrush(color);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
